//
//  CategoryPageTool.m
//  MindBox
//
//  Created by MS on 16-1-5.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "CategoryPageTool.h"
#import "LGHttpTool.h"
#import "MJExtension.h"

@implementation CategoryPageTool
+ (void)categoryNameDataWithSuccess:(void (^)( NSArray * data))success
                        failure:(void (^)( NSError *error))failure
{
    [LGHttpTool GET:Category_Name_URL parameters:nil success:^(id responseObject) {
        
        Category_Name_Model * category = [Category_Name_Model mj_objectWithKeyValues:responseObject];
        NSArray * data = category.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];

}

+ (void)categoryGoodsDataWithCat_Id:(NSString *)cat_id Success:(void (^)( NSArray * data))success failure:(void (^)( NSError *error))failure
{
    NSString * url = Category_Goods_URL(cat_id);
    
    [LGHttpTool GET:url parameters:nil success:^(id responseObject) {
        
        Category_Goods_Model * category_goods = [Category_Goods_Model mj_objectWithKeyValues:responseObject];
        NSArray * data = category_goods.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];

}

+ (void)categoryLabelDataWithSuccess:(void (^)( NSArray * data))success
                             failure:(void (^)( NSError *error))failure
{
    
    [LGHttpTool GET:Category_Label_URL parameters:nil success:^(id responseObject) {
        
        Category_Label_Model * labelData = [Category_Label_Model mj_objectWithKeyValues:responseObject];
        NSArray * data = labelData.data;
        
        if (success) {
            
            success(data);
        }
        
    } failure:^(NSError *error) {
        if (failure) {
            failure(error);
        }
    }];

    
}
@end
